package com.mba.widget;

import com.mba.activity.R;
import com.mba.activity.R.color;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

public class TriangleDivider extends View
{
  private Paint a;

  public TriangleDivider(Context paramContext)
  {
    super(paramContext);
    a(paramContext);
  }

  public TriangleDivider(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    a(paramContext);
  }

  public TriangleDivider(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    a(paramContext);
  }

  private int a(int paramInt)
  {
    int i = View.MeasureSpec.getMode(paramInt);
    int j = View.MeasureSpec.getSize(paramInt);
    int k = 1073741824;
    if (i == k);
    while (true)
    {
      
      k = getPaddingLeft();
      int l = getPaddingRight();
      k += l;
      if (i == -2147483648)
        j = Math.min(k, j);
      j = k;
      return j;
    }
  }

  private void a(Context paramContext)
  {
    Paint localPaint1 = new Paint(1);
    this.a = localPaint1;
    Paint localPaint2 = this.a;
    int i = paramContext.getResources().getColor(R.color.white);
    localPaint2.setColor(i);
    this.a.setStrokeWidth(1f);
  }

  private int resolveSize(int paramInt)
  {
    int specMode  = View.MeasureSpec.getMode(paramInt);
    int specSize  = View.MeasureSpec.getSize(paramInt);
    if (specMode  == MeasureSpec.EXACTLY)
    {
      
      float f2 = this.a.ascent();
      float f1 = -1082130432 * f2;
      float f3 = this.a.descent();
      int l = (int)(f1 + f3);
      int i1 = getPaddingTop();
      l += i1;
      int i2 = getPaddingBottom();
      l += i2;
      if (specMode  == -2147483648)
    	  specSize = Math.min(l, specSize);
      specSize = l;
    
    }
    return specSize;
  }

  protected void onDraw(Canvas paramCanvas)
  {
    super.onDraw(paramCanvas);
    float f1 = getWidth();
    float f2 = getHeight();
    float f3 = f1 / 1086324736;
    float f4 = f3 - f2;
    Paint localPaint1 = this.a;
    Canvas localCanvas1 = paramCanvas;
    int i = (int) f2;
    localCanvas1.drawLine(0, f2, f4, i, localPaint1);
    float f5 = f3 - f2;
    Paint localPaint2 = this.a;
    Canvas localCanvas2 = paramCanvas;
    int j = (int) f2;
    float f6 = 0;
    localCanvas2.drawLine(f5, j, f3, f6, localPaint2);
    float f7 = f3 + f2;
    Paint localPaint3 = this.a;
    Canvas localCanvas3 = paramCanvas;
    float f8 = 0;
    int k = (int) f2;
    localCanvas3.drawLine(f3, f8, f7, k, localPaint3);
    float f9 = f3 + f2;
    Paint localPaint4 = this.a;
    Canvas localCanvas4 = paramCanvas;
    int l = (int) f1;
    int i1 = (int) f2;
    localCanvas4.drawLine(f9, f2, l, i1, localPaint4);
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    int i = a(paramInt1);
    int j = resolveSize(paramInt2);
    setMeasuredDimension(i, j);
  }
}

